package gummachine.client;

import gummachine.remote.GumballMachineRemote;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

/**
 * description:
 *  rmi客户端
 * @author Yuanml on 2020/10/29 17:22
 */
public class Client {
    public static void main(String[] args) throws RemoteException, NotBoundException, MalformedURLException {
        GumballMachineRemote gumballMachineRemote0 = (GumballMachineRemote)Naming.lookup("rmi://127.0.0.1:1099/gumballMachineRemote0");
        GumballMachineRemote gumballMachineRemote1 = (GumballMachineRemote)Naming.lookup("rmi://127.0.0.1:1099/gumballMachineRemote1");
        GumballMachineRemote gumballMachineRemote2 = (GumballMachineRemote)Naming.lookup("rmi://127.0.0.1:1099/gumballMachineRemote2");
        System.out.println(gumballMachineRemote0.report());
        System.out.println(gumballMachineRemote1.report());
        System.out.println(gumballMachineRemote2.report());
    }
}
